<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
</head>
<body>
<div id="app">
    <el-page-header style="background-color: #0096dc;color: white;line-height: 60px"
                    @back="goBack" content="修改用户信息页面">
    </el-page-header>
    <el-card style="width: 600px;height: 800px;margin: 0 auto">
        <el-form label-width="80px">
            <el-form-item label="昵称"><el-input type="text" v-model="u.nickname"></el-input></el-form-item>
            <el-form-item label="手机号"><el-input type="text" v-model="u.phone"></el-input></el-form-item>
            <el-form-item label="密码"><el-input type="text" v-model="u.password"></el-input></el-form-item>
            <el-form-item label="邮箱"><el-input type="text" v-model="u.email"></el-input></el-form-item>
            <el-form-item label="状态"><el-input type="text" v-model="u.status"></el-input></el-form-item>
            <el-form-item>
                <el-button type="success" @click="update()">修改用户信息</el-button>
            </el-form-item>
        </el-form>
    </el-card >


</div>
</body>
<!--引入axios和vue框架文件-->
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>
    let v = new Vue({
        el: '#app',
        data: function () {
            return {
                u:{nickname:"",phone:"",status:"",
                    password:"",email:""},
            }

        },
        methods:{
            update() {
                //发请求
                axios.post("/user/update",v.u).then(function (response) {
                    location.href="/admin.html";//回到后台管理页面
                })
            },
            goBack(){
                //返回上一页面
                history.back();
            },
        },
        created:function (){
            //发出请求获取用户信息
            axios.get("/user/selectUpdateById"+location.search).then(function (response) {
                v.u=response.data;
            })
        }
    })
</script>
</html>